package com.chance.common.utils;


import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class RedisImagesAddUtil {

    private static RedisTemplate staticRedisTemplate;

    @Autowired
    private RedisTemplate redisTemplate;

    @PostConstruct
    public void init() {
        staticRedisTemplate = redisTemplate;
    }

    public static void imageAddRedis(String key, String url) {
        staticRedisTemplate.opsForSet().add(key, url);
    }

    public static String parseUrl(String url) {
        return url.split("lease/")[1];
    }
}
